/**
 */
package js.backbone.impl;

import java.util.Collection;

import js.backbone.BackboneApp;
import js.backbone.BackbonePackage;
import js.backbone.Collections;
import js.backbone.Model;
import js.backbone.Router;
import js.backbone.Template;
import js.backbone.View;

import js.impl.GlobalObjectImpl;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>App</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getModels <em>Models</em>}</li>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getCollections <em>Collections</em>}</li>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getRouters <em>Routers</em>}</li>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getViews <em>Views</em>}</li>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getTemplates <em>Templates</em>}</li>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getDelegates <em>Delegates</em>}</li>
 *   <li>{@link js.backbone.impl.BackboneAppImpl#getSubsystems <em>Subsystems</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BackboneAppImpl extends GlobalObjectImpl implements BackboneApp {
	/**
	 * The cached value of the '{@link #getModels() <em>Models</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getModels()
	 * @generated
	 * @ordered
	 */
	protected EList<Model> models;

	/**
	 * The cached value of the '{@link #getCollections() <em>Collections</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCollections()
	 * @generated
	 * @ordered
	 */
	protected EList<Collections> collections;

	/**
	 * The cached value of the '{@link #getRouters() <em>Routers</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRouters()
	 * @generated
	 * @ordered
	 */
	protected EList<Router> routers;

	/**
	 * The cached value of the '{@link #getViews() <em>Views</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getViews()
	 * @generated
	 * @ordered
	 */
	protected EList<View> views;

	/**
	 * The cached value of the '{@link #getTemplates() <em>Templates</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTemplates()
	 * @generated
	 * @ordered
	 */
	protected EList<Template> templates;

	/**
	 * The cached value of the '{@link #getDelegates() <em>Delegates</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDelegates()
	 * @generated
	 * @ordered
	 */
	protected EList<js.Object> delegates;

	/**
	 * The cached value of the '{@link #getSubsystems() <em>Subsystems</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSubsystems()
	 * @generated
	 * @ordered
	 */
	protected EList<js.Object> subsystems;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BackboneAppImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return BackbonePackage.Literals.BACKBONE_APP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Model> getModels() {
		if (models == null) {
			models = new EObjectContainmentEList<Model>(Model.class, this, BackbonePackage.BACKBONE_APP__MODELS);
		}
		return models;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Collections> getCollections() {
		if (collections == null) {
			collections = new EObjectContainmentEList<Collections>(Collections.class, this, BackbonePackage.BACKBONE_APP__COLLECTIONS);
		}
		return collections;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Router> getRouters() {
		if (routers == null) {
			routers = new EObjectContainmentEList<Router>(Router.class, this, BackbonePackage.BACKBONE_APP__ROUTERS);
		}
		return routers;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<View> getViews() {
		if (views == null) {
			views = new EObjectContainmentEList<View>(View.class, this, BackbonePackage.BACKBONE_APP__VIEWS);
		}
		return views;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Template> getTemplates() {
		if (templates == null) {
			templates = new EObjectContainmentEList<Template>(Template.class, this, BackbonePackage.BACKBONE_APP__TEMPLATES);
		}
		return templates;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<js.Object> getDelegates() {
		if (delegates == null) {
			delegates = new EObjectContainmentEList<js.Object>(js.Object.class, this, BackbonePackage.BACKBONE_APP__DELEGATES);
		}
		return delegates;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<js.Object> getSubsystems() {
		if (subsystems == null) {
			subsystems = new EObjectContainmentEList<js.Object>(js.Object.class, this, BackbonePackage.BACKBONE_APP__SUBSYSTEMS);
		}
		return subsystems;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case BackbonePackage.BACKBONE_APP__MODELS:
				return ((InternalEList<?>)getModels()).basicRemove(otherEnd, msgs);
			case BackbonePackage.BACKBONE_APP__COLLECTIONS:
				return ((InternalEList<?>)getCollections()).basicRemove(otherEnd, msgs);
			case BackbonePackage.BACKBONE_APP__ROUTERS:
				return ((InternalEList<?>)getRouters()).basicRemove(otherEnd, msgs);
			case BackbonePackage.BACKBONE_APP__VIEWS:
				return ((InternalEList<?>)getViews()).basicRemove(otherEnd, msgs);
			case BackbonePackage.BACKBONE_APP__TEMPLATES:
				return ((InternalEList<?>)getTemplates()).basicRemove(otherEnd, msgs);
			case BackbonePackage.BACKBONE_APP__DELEGATES:
				return ((InternalEList<?>)getDelegates()).basicRemove(otherEnd, msgs);
			case BackbonePackage.BACKBONE_APP__SUBSYSTEMS:
				return ((InternalEList<?>)getSubsystems()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case BackbonePackage.BACKBONE_APP__MODELS:
				return getModels();
			case BackbonePackage.BACKBONE_APP__COLLECTIONS:
				return getCollections();
			case BackbonePackage.BACKBONE_APP__ROUTERS:
				return getRouters();
			case BackbonePackage.BACKBONE_APP__VIEWS:
				return getViews();
			case BackbonePackage.BACKBONE_APP__TEMPLATES:
				return getTemplates();
			case BackbonePackage.BACKBONE_APP__DELEGATES:
				return getDelegates();
			case BackbonePackage.BACKBONE_APP__SUBSYSTEMS:
				return getSubsystems();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case BackbonePackage.BACKBONE_APP__MODELS:
				getModels().clear();
				getModels().addAll((Collection<? extends Model>)newValue);
				return;
			case BackbonePackage.BACKBONE_APP__COLLECTIONS:
				getCollections().clear();
				getCollections().addAll((Collection<? extends Collections>)newValue);
				return;
			case BackbonePackage.BACKBONE_APP__ROUTERS:
				getRouters().clear();
				getRouters().addAll((Collection<? extends Router>)newValue);
				return;
			case BackbonePackage.BACKBONE_APP__VIEWS:
				getViews().clear();
				getViews().addAll((Collection<? extends View>)newValue);
				return;
			case BackbonePackage.BACKBONE_APP__TEMPLATES:
				getTemplates().clear();
				getTemplates().addAll((Collection<? extends Template>)newValue);
				return;
			case BackbonePackage.BACKBONE_APP__DELEGATES:
				getDelegates().clear();
				getDelegates().addAll((Collection<? extends js.Object>)newValue);
				return;
			case BackbonePackage.BACKBONE_APP__SUBSYSTEMS:
				getSubsystems().clear();
				getSubsystems().addAll((Collection<? extends js.Object>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case BackbonePackage.BACKBONE_APP__MODELS:
				getModels().clear();
				return;
			case BackbonePackage.BACKBONE_APP__COLLECTIONS:
				getCollections().clear();
				return;
			case BackbonePackage.BACKBONE_APP__ROUTERS:
				getRouters().clear();
				return;
			case BackbonePackage.BACKBONE_APP__VIEWS:
				getViews().clear();
				return;
			case BackbonePackage.BACKBONE_APP__TEMPLATES:
				getTemplates().clear();
				return;
			case BackbonePackage.BACKBONE_APP__DELEGATES:
				getDelegates().clear();
				return;
			case BackbonePackage.BACKBONE_APP__SUBSYSTEMS:
				getSubsystems().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case BackbonePackage.BACKBONE_APP__MODELS:
				return models != null && !models.isEmpty();
			case BackbonePackage.BACKBONE_APP__COLLECTIONS:
				return collections != null && !collections.isEmpty();
			case BackbonePackage.BACKBONE_APP__ROUTERS:
				return routers != null && !routers.isEmpty();
			case BackbonePackage.BACKBONE_APP__VIEWS:
				return views != null && !views.isEmpty();
			case BackbonePackage.BACKBONE_APP__TEMPLATES:
				return templates != null && !templates.isEmpty();
			case BackbonePackage.BACKBONE_APP__DELEGATES:
				return delegates != null && !delegates.isEmpty();
			case BackbonePackage.BACKBONE_APP__SUBSYSTEMS:
				return subsystems != null && !subsystems.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //BackboneAppImpl
